package cn.donting.jme.expansion.builder.light;

import cn.donting.jme.EditorContent;
import cn.donting.jme.editor.scene.Scene;
import cn.donting.jme.editor.scene.wrapper.DirectionalLightWrapper;
import cn.donting.jme.editor.scene.wrapper.LightWrapper;
import cn.donting.jme.expansion.attribute.Attribute;
import cn.donting.jme.expansion.attribute.lmpl.Vector3fAttribute;
import cn.donting.jme.ioc.Bean;
import cn.donting.jme.ioc.Sort;
import com.jme3.light.AmbientLight;
import com.jme3.light.DirectionalLight;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;

import javax.swing.*;
import java.util.List;

@Bean
public class AmbientLightAttributeBuilder extends LightAttributeBuilder<AmbientLight> {
    @Override
    public boolean isHandle(Object o) {
        return o instanceof AmbientLight;
    }

    @Override
    public AmbientLight newInstance() {
        AmbientLight ambientLight = new AmbientLight();
        ambientLight.setName("环境光");
        LightWrapper wrapper = EditorContent.getScene().getWrapper(ambientLight, LightWrapper.class);
        wrapper.setColor(ColorRGBA.White.clone());
        wrapper.setIntensity(0.2f);
        ambientLight.setColor(wrapper.toColorRGBA());
        return ambientLight;
    }

    @Override
    public Icon getIcon(int size) {
        return null;
    }

    @Override
    public Icon getActiveIcon(int size) {
        return null;
    }

    @Override
    public String getName() {
        return "环境光";
    }

    @Override
    public void attribute(List<Attribute> attributes, AmbientLight ambientLight) {
        super.attribute(attributes,ambientLight);
    }
}
